// pages/pagenav/pagenav.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    i: 0,
    traffics: [{
      name: "bike",
      title: "自行车"
    }, {
      name: "bus",
      title: "公交车"
    }, {
      name: "subway",
      title: "地铁"
    }, {
      name: "rocket",
      title: "火箭"
    }]
  },
  //处理picker选择事件
  picker: function (e) {
    console.log(e)
    this.setData({
      i: e.detail.value
    })
  },
  //处理表单提交数据
  pagetrip: function (e) {
    console.log(e)
    var name = e.detail.value.name
    var dest = e.detail.value.dest
    var i = e.detail.value.traffic
    var traffics = this.data.traffics
    var url = '../pagetrip/pagetrip'
    url += "?name=" + name
    url += "&dest=" + dest
    url += "&traffic=" + traffics[i].title
    console.log(url)
    wx.navigateTo({
      url: url
    })
  },
})